#define _CRT_SECURE_NO_WARNINGS 1


#include<vector>
#include<iostream>

using namespace std;

vector<int> Func(vector<int>& v1, vector<int>& v2)
{
	int cur1 = v1.size() - 1, cur2 = v2.size() - 1;
	vector<int> v;
	int next = 0;
	while (cur1 >= 0 && cur2 >= 0)
	{
		int ret = v1[cur1--]+ v2[cur2--] + next;
		next = ret / 10;
		ret %= 10;
		v.push_back(ret);
	}
	while (cur1 >= 0)
	{
		int ret = v1[cur1--] + next;
		next = ret / 10;
		ret %= 10;
		v.push_back(ret);
	}
	while (cur2 >= 0)
	{
		int ret = v2[cur2--] + next;
		next = ret / 10;
		ret %= 10;
		v.push_back(ret);
	}
	if (next)
	{
		v.push_back(next);
	}
	reverse(v.begin(), v.end());
	return v;
}

vector<int> plusOne(vector<int>& digits)
{
	vector<int> v = { 1 };
	return Func(digits, v);
}

//int main()
//{
//	vector<int> v = { 4,3,2,1 };
//	vector<int> ret = plusOne(v);
//	for (auto& e : ret)
//	{
//		cout << e << ' ';
//	}
//	cout << endl;
//
//	return 0;
//}